<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>
</head>
<body>
   <script>
      var arr = [8,2,32,4,1,9]
      function maopao(arr){
         var temp;
         for(var i=0; i<arr.length; i++){
            for(var j=1; j<arr.length-1-i; j++){
               if(arr[j-1]>arr[j]){
                  temp = arr[j];
                  arr[j] = arr[j-1];
                  arr[j-1] = temp;
               }
            }
         }
         return arr
      }
      var res = maopao(arr)
      console.log(res)
      
   </script>
</body>
</html>